package com.cyzy.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class ResponseData {
    private int code;  //状态码 ： 业务的处理结果状态   ： 自己定义 0:登录成功   -1:登录/查询/注册/添加失败     200成功   500错误
    private String message;  //描述
    private Object data;     //数据    对象或ArrayList
    private int total;//分页的总行数


    public static ResponseData ok() {
        return new ResponseData(200, "success", null, 0);
    }

    public static ResponseData no() {
        return new ResponseData(300, "失败", null, 0);
    }

    public static ResponseData no2(String message) {
        return new ResponseData(300, message, null, 0);
    }
    public static ResponseData ok2(Object data) {
        return new ResponseData(200, "成功", data, 0);}
}
